var Player;
Player = function (name) {
    this.name = name;
    this.age = 18;
    this.stats = {"Defense"      : 0,
                  "Shooting"     : 0,
                  "3pt Shooting" : 0,
                  "Blocking"     : 0,
                  "Steals"       : 0,
                  "Handles"      : 0,
                  "Rebounds"     : 0
    };
    this.weights = {"Defense" : 0.15,
                    "Shooting" : 0.15,
                    "3pt Shooting" : 0.14,
                    "Blocking" : 0.14,
                    "Steals" : 0.12,
                    "Handles" : 0.13,
                    "Rebounds" : 0.14
    };
    this.overall = 0;

    this.generate = function() {
        for(var x in this.stats) {
            this.stats[x] = Math.floor(Math.random() * 36 + 45);
        }

        this.calculateOverall();
    };

    this.calculateOverall = function() {
        this.overall = 0;

        for(var x in this.stats) {
            this.overall += this.stats[x] * this.weights[x];
        }

        this.overall = Math.round(this.overall);
    };

    this.printHTML = function() {
        var output = "";

        output += "Name: "+ this.name +"<br />";
        output += "Age: "+ this.age +"<br />";

        for(var x in this.stats) {
            output += x +": "+ this.stats[x] +"<br />";
        }

        output += "Overall: "+ this.overall +"<br />";

        return output;
    }
};

var firstNames = ["Aiden","Jackson","Ethan","Liam","Mason","Noah","Lucas","Jacob","Jayden","Jack","Logan","Ryan","Caleb","William","Michael","Elijah","Matthew","Dylan","James","Owen","Connor","Brayden","Carter","Landon","Joshua","Luke","Daniel","Nicholas","Nathan","Henry","Andrew","Gavin","Cameron","Eli","Max","Isaac","Evan"];
var lastNames = ["Smith","Johnson","Williams","Brown","Jones","Miller","Davis","Garcia","Rodriguez","Wilson","Martinez","Anderson","Taylor","Hernandez","Moore","Martin","Martin","Jackson","Thompson","White","Lopez","Gonzalez","Harris","Clark","Lewis","Robinson","Walker","Perez","Hall","Young","Allen"];

function generateName() {
    return firstNames[Math.floor(Math.random()*firstNames.length)] +" "+ lastNames[Math.floor(Math.random()*lastNames.length)];
}